home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
- Path: blackbush.xlink.net!slsv6bt!slsv6bt!kanze
- From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
- Subject: Undefined behavior? on type conversion, was: Re: Hungarian notation
- In-Reply-To: miker3@ix.netcom.com's message of Wed, 24 Jan 1996 12:37:05 GMT
- Message-ID: <KANZE.96Jan24152858@slsvewt.lts.sel.alcatel.de>
- Sender: news@lts.sel.alcatel.de
- Organization: SEL
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl>
- <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca>
- <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com>
- <3104bfc8.132251392@nntp.ix.netcom.com> <dewar.822407919@schonberg>
- <3106260f.224013120@nntp.ix.netcom.com>
- Date: 24 Jan 1996 14:28:58 GMT
-
- In article <3106260f.224013120@nntp.ix.netcom.com>
- miker3@ix.netcom.com (Mike Rubenstein) writes:
-
- |> dewar@cs.nyu.edu (Robert Dewar) wrote:
-
- |> > Michael says (talking about overflow in C)
- |> >
- |> > "An implementation must handle this and must document how it does so."
- |> >
- |> > Yes, of course the documentation may say that the result is to delete
- |> > your system disk. Even if a more reasonable behavior is described, any
- |> > program relying on such an implementation dependent feature is of
- |> > course compromising its portability. One of the troubles with C is
- |> > that it is oh-so-easy to introduce implementation dependence.
- |> >
- |> > It is interesting to note that a number of "bug" reports sent into gcc
- |> > are complaints that GCC does not duplicate some implementation
- |> > dependent behavior seen in some other compiler.
-
- |> Is it really necessary to post this kind of nonsense. No, the
- |> documentation may not say the result is to delete your system disk.
- |> Repeating the quote from ISO 6.2.1.2
-
- |> When a value with integral type is demoted to a signed integer
- |> with smaller size or an unsigned integer is converted to its
- |> corresponding signed integer, if the value cannot be
- |> represented the result is implementation defined.
-
- |> This requires an implementation to convert the integral type. It does
- |> not give it license to take actions not specified by the standard.
-
- Does it? I believe that it was the intent of the authors that the
- `result' of the conversion could be a signal (for example) or a core
- dump. (This is, of course, the only reasonable thing for an
- implementation to do.)
- --
- James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
- Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
- -- A la recherche d'une activitΘ dans une region francophone
-
-